function GAD_Etom_PlaceCell_vs_Non_PlaceCell_ER_CDFs(Mobility_and_ER_Data_Summary)
%% Compute place cell & non-place cell ER CDFs for p-WT first
WT_PlaceCell_ER = [];
for n = 1:size(Mobility_and_ER_Data_Summary,2)
    if isempty(WT_PlaceCell_ER) && strcmp(Mobility_and_ER_Data_Summary(n).genotype, 'a5-i-WT')
        WT_PlaceCell_ER = Mobility_and_ER_Data_Summary(n).PlaceCellER_Summary;
    elseif ~isempty(WT_PlaceCell_ER) && strcmp(Mobility_and_ER_Data_Summary(n).genotype, 'a5-i-WT')
        WT_PlaceCell_ER = cat(1, WT_PlaceCell_ER, Mobility_and_ER_Data_Summary(n).PlaceCellER_Summary);
    end
end

WT_NonPlaceCell_ER = [];
for n = 1:size(Mobility_and_ER_Data_Summary,2)
    if isempty(WT_NonPlaceCell_ER) && strcmp(Mobility_and_ER_Data_Summary(n).genotype, 'a5-i-WT')
        WT_NonPlaceCell_ER = Mobility_and_ER_Data_Summary(n).NonPlaceCellER_Summary;
    elseif ~isempty(WT_NonPlaceCell_ER) && strcmp(Mobility_and_ER_Data_Summary(n).genotype, 'a5-i-WT')
        WT_NonPlaceCell_ER = cat(1, WT_NonPlaceCell_ER, Mobility_and_ER_Data_Summary(n).PlaceCellER_Summary);
    end
end

[WT_Place_ER_F, WT_Place_ER_X, ~, ~] = ecdf(WT_PlaceCell_ER,'Function','cdf','Alpha',0.05);
WT_Place_ER_X = cat(1, 0, WT_Place_ER_X, 1);
WT_Place_ER_F = cat(1, 0, WT_Place_ER_F, 1);
[WT_NonPlace_ER_F, WT_NonPlace_ER_X, ~, ~] = ecdf(WT_NonPlaceCell_ER,'Function','cdf','Alpha',0.05);
WT_NonPlace_ER_X = cat(1, 0, WT_NonPlace_ER_X, 1);
WT_NonPlace_ER_F = cat(1, 0, WT_NonPlace_ER_F, 1);

%% Compute place cell & non-place cell ER CDFs for a5-i-KO
KO_PlaceCell_ER = [];
for n = 1:size(Mobility_and_ER_Data_Summary,2)
    if isempty(KO_PlaceCell_ER) && strcmp(Mobility_and_ER_Data_Summary(n).genotype, 'a5-i-KO')
        KO_PlaceCell_ER = Mobility_and_ER_Data_Summary(n).PlaceCellER_Summary;
    elseif ~isempty(KO_PlaceCell_ER) && strcmp(Mobility_and_ER_Data_Summary(n).genotype, 'a5-i-KO')
        KO_PlaceCell_ER = cat(1, KO_PlaceCell_ER, Mobility_and_ER_Data_Summary(n).PlaceCellER_Summary);
    end
end

KO_NonPlaceCell_ER = [];
for n = 1:size(Mobility_and_ER_Data_Summary,2)
    if isempty(KO_NonPlaceCell_ER) && strcmp(Mobility_and_ER_Data_Summary(n).genotype, 'a5-i-KO')
        KO_NonPlaceCell_ER = Mobility_and_ER_Data_Summary(n).NonPlaceCellER_Summary;
    elseif ~isempty(KO_NonPlaceCell_ER) && strcmp(Mobility_and_ER_Data_Summary(n).genotype, 'a5-i-KO')
        KO_NonPlaceCell_ER = cat(1, KO_NonPlaceCell_ER, Mobility_and_ER_Data_Summary(n).PlaceCellER_Summary);
    end
end

[KO_Place_ER_F, KO_Place_ER_X, ~, ~] = ecdf(KO_PlaceCell_ER,'Function','cdf','Alpha',0.05);
KO_Place_ER_X = cat(1, 0, KO_Place_ER_X, 1);
KO_Place_ER_F = cat(1, 0, KO_Place_ER_F, 1);
[KO_NonPlace_ER_F, KO_NonPlace_ER_X, ~, ~] = ecdf(KO_NonPlaceCell_ER,'Function','cdf','Alpha',0.05);
KO_NonPlace_ER_X = cat(1, 0, KO_NonPlace_ER_X, 1);
KO_NonPlace_ER_F = cat(1, 0, KO_NonPlace_ER_F, 1);

%% plot graphs
figure
subplot(1,2,1)
plot(WT_Place_ER_X, WT_Place_ER_F, 'r', 'LineWidth', 3);
hold on
plot(WT_NonPlace_ER_X, WT_NonPlace_ER_F, 'b', 'LineWidth', 3);
xlim([0,0.4]);
xlabel('Event Rate (Hz)')
ylabel('Cumulative Fraction of Cells')
legend('Place Cells', 'Non-Place Cells', 'Location', 'southeast')
set(gca, 'FontSize', 20)
title('p-WT', 'FontSize', 25)
hold off

subplot(1,2,2)
plot(KO_Place_ER_X, KO_Place_ER_F, 'r', 'LineWidth', 3);
hold on
plot(KO_NonPlace_ER_X, KO_NonPlace_ER_F, 'b', 'LineWidth', 3);
xlim([0,0.4]);
xlabel('Event Rate (Hz)')
ylabel('Cumulative Fraction of Cells')
legend('Place Cells', 'Non-Place Cells', 'Location', 'southeast')
set(gca, 'FontSize', 20)
title('\alpha5-i-KO', 'FontSize', 25)
hold off

end